import request from "@/utils/request";

// 页面图标及内容接口
export const getMianShi = (params) => {
  return request({
    method: "GET",
    url: "/articles",
    params,
  });
};

//文章状态
export const editState = (id, state) => {
  return request({
    method: "POST",
    url: `/articles/${id}/${state}`,
  });
};

//文章添加
export const getAdd = (data) => {
  return request({
    method: "POST",
    url: "/articles",
    data,
  });
};

//文章删除
export const getDelete = (id) => {
  return request({
    method: "DELETE",
    url: `/articles/${id}`,
  });
};
//根据id获取文章数据 点击修改按钮
export const getId = (id) => {
  return request({
    method: "GET",
    url: `/articles/${id}`,
  });
};
//点击修改按钮 确认按钮触发的事件
export const getChange = (id, data) => {
  return request({
    method: "PUT",
    url: `/articles/${id}`,
    data,
  });
};

//预览按钮操作
export const  getPreview = (id) => {
  return request({
    method: "GET",
    url: `/articles/${id}`,
  });
};